import Vue from 'vue'
import Vuex from 'vuex'
import user from './modules/user'
import detail from './modules/detail'
import websocket from './modules/websocket'
import getters from './getters'
Vue.use(Vuex)


export default new Vuex.Store({
  state: {
    editor: false,
    comment: false,
    commentRefresh: false,
    online: 0,
    tempRouterPath: ''
  },
  mutations: {
    hiddenEditor(state) {
      state.editor = false;
    },
    showEditor(state) {
      state.editor = true;
    },
    showComment(state) {
      state.comment = true;
    },
    hiddenComment(state) {
      state.comment = false;
    },
    publishCommentRefresh(state) {
      state.commentRefresh = !state.commentRefresh;
    },
    updateOnline(state, count) {
      state.online = count;
    },
    setTempRouterPath(state, path) {
      state.tempRouterPath = path;
    }
  },
  actions: {
    update({commit}, count) {
      commit('updateOnline',count)
    }
  },
  modules: {
    user,
    detail,
    websocket
  },
  getters
})